home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 43.zip / Sources C- WorkDisk III.adf / v.c < prev    next >
C/C++ Source or Header  |  1987-02-19  |  7KB  |  347 lines

  1.  
  2. #include <exec/types.h>
  3. #include <intuition/intuition.h>
  4.  
  5. struct Library *DiskfontBase;
  6. struct IntuitionBase *IntuitionBase;
  7. struct GfxBase *GfxBase;
  8. struct LayersBase *LayersBase;
  9. struct Screen *CustScr;
  10. struct BitMap BitMap;
  11. struct Window *Wdw;
  12. struct ViewPort *WVP;
  13. struct IntuiMessage *message;
  14. struct TextFont *FontPtr;
  15. ULONG class;
  16.  
  17. #define Rp   Wdw->RPort
  18. #define BLACK 0x000
  19. #define BGRP    0
  20. #define MODBLU 0x10
  21. #define MODRED 0x20
  22. #define MODGRN 0x30
  23. #define RON 0x555
  24. #define JOHN 0x820
  25. struct NewScreen NewCustScr =
  26.                  {
  27. 0,0,
  28. 320,200,6,
  29. 1,0,
  30. HAM,
  31. CUSTOMSCREEN,
  32. NULL,
  33. NULL,
  34. NULL,
  35. NULL,
  36. };
  37.  
  38. struct NewWindow NewWdw =
  39. {
  40. 0,0,
  41. 320,200,
  42. NULL,NULL,
  43. VANILLAKEY,
  44. VANILLAKEY + SUPER_BITMAP + ACTIVATE + SMART_REFRESH
  45.  + BORDERLESS,
  46. NULL,
  47. NULL,
  48. NULL,
  49. NULL,
  50. NULL,
  51. 0,0,
  52. 0,0,
  53. CUSTOMSCREEN
  54. };
  55.  
  56. main()
  57. {
  58. int x;
  59.  
  60. IntuitionBase = (struct IntuitionBase *)
  61. OpenLibrary("intuition.library",LIBRARY_VERSION);
  62. if (IntuitionBase == NULL) exit(100);
  63.  
  64. GfxBase = (struct GfxBase *)
  65. OpenLibrary("graphics.library",LIBRARY_VERSION);
  66. if (GfxBase == NULL) exit(200);
  67.  
  68. LayersBase = (struct LayersBase *)
  69. OpenLibrary("layers.library",LIBRARY_VERSION);
  70. if (LayersBase == NULL) exit(300);
  71.  
  72.  
  73. if ((NewWdw.Screen = CustScr =
  74. (struct Screen *)OpenScreen(&NewCustScr)) == NULL)
  75.     exit(400);
  76.  
  77. if ((Wdw = (struct Window *)OpenWindow(&NewWdw)) == NULL)
  78.     exit(500);
  79.  
  80. InitBitMap(&BitMap,2,3840,20);
  81.  
  82. for (x=0;x<2;x++)
  83. if
  84. ((BitMap.Planes[x] = (PLANEPTR)AllocRaster(7880,20)) ==0)
  85. exit(600);
  86. else BltClear (BitMap.Planes[x],3658,0);
  87.  
  88. NewWdw.BitMap = (struct BitMap *)&BitMap;
  89.  
  90. if (( Wdw = (struct Window *)OpenWindow(&NewWdw)) ==0)
  91. exit(700);
  92.  
  93. WVP = (struct ViewPort *)ViewPortAddress(Wdw);
  94. SetRGB4(WVP,0,0,0,0);
  95. SetRGB4(WVP,1,4,4,4);
  96. SetRGB4(WVP,2,5,5,5);
  97. SetRGB4(WVP,3,6,6,6);
  98. SetRGB4(WVP,4,7,7,7);
  99. SetRGB4(WVP,5,8,8,8);
  100. SetRGB4(WVP,6,9,9,9);
  101. SetRGB4(WVP,7,10,10,10);
  102. SetRGB4(WVP,8,11,11,11);
  103. SetRGB4(WVP,9,12,12,12);
  104. SetRGB4(WVP,10,13,13,13);
  105. SetRGB4(WVP,11,14,14,14);
  106. SetRGB4(WVP,12,15,15,15);
  107. demo();
  108.  
  109. Wait(1<<Wdw->UserPort->mp_SigBit);
  110.  
  111. for (x=0;x<2;x++)
  112. if (BitMap.Planes[x] |= 0)
  113. FreeRaster(BitMap.Planes[x],3840,25);
  114.  
  115. CloseWindow(Wdw);
  116. CloseScreen(CustScr);
  117. CloseLibrary(GfxBase);
  118. CloseLibrary(IntuitionBase);
  119. CloseLibrary(LayersBase);
  120.  
  121. }
  122.  
  123. demo()
  124.  
  125. {
  126. int line;
  127. int c,d,e;
  128.  
  129. SetAPen(Rp,BLACK);
  130. RectFill(Rp,0,0,320,29);
  131. SetAPen(Rp,1);
  132. RectFill(Rp,0,30,320,32);
  133. SetAPen(Rp,2);
  134. RectFill(Rp,0,32,320,34);
  135. SetAPen(Rp,3);
  136. RectFill(Rp,0,34,320,36);
  137. SetAPen(Rp,4);
  138. RectFill(Rp,0,36,320,38);
  139. SetAPen(Rp,5);
  140. RectFill(Rp,0,38,320,40);
  141. SetAPen(Rp,6);
  142. RectFill(Rp,0,40,320,42);
  143. SetAPen(Rp,7);
  144. RectFill(Rp,0,42,320,44);
  145. SetAPen(Rp,8);
  146. RectFill(Rp,0,44,320,46);
  147. SetAPen(Rp,9);
  148. RectFill(Rp,0,46,320,48);
  149. SetAPen(Rp,10);
  150. RectFill(Rp,0,48,320,50);
  151. SetAPen(Rp,11);
  152. RectFill(Rp,0,50,320,52);
  153. SetAPen(Rp,12);
  154. RectFill(Rp,0,52,320,54);
  155. SetAPen(Rp,11);
  156. RectFill(Rp,0,54,320,56);
  157. SetAPen(Rp,10);
  158. RectFill(Rp,0,56,320,58);
  159. SetAPen(Rp,9);
  160. RectFill(Rp,0,58,320,60);
  161. SetAPen(Rp,8);
  162. RectFill(Rp,0,60,320,62);
  163. SetAPen(Rp,7);
  164. RectFill(Rp,0,62,320,64);
  165. SetAPen(Rp,6);
  166. RectFill(Rp,0,64,320,66);
  167. SetAPen(Rp,5);
  168. RectFill(Rp,0,66,320,68);
  169. SetAPen(Rp,4);
  170. RectFill(Rp,0,68,320,70);
  171. SetAPen(Rp,3);
  172. RectFill(Rp,0,70,320,72);
  173. SetAPen(Rp,2);
  174. RectFill(Rp,0,72,320,74);
  175. SetAPen(Rp,1);
  176. RectFill(Rp,0,74,320,76);
  177.  
  178. SetAPen(Rp,MODBLU+2);
  179. RectFill(Rp,0,90,320,92);
  180. SetAPen(Rp,MODBLU+3);
  181. RectFill(Rp,0,92,320,94);
  182. SetAPen(Rp,MODBLU+4);
  183. RectFill(Rp,0,94,320,96);
  184. SetAPen(Rp,MODBLU+5);
  185. RectFill(Rp,0,96,320,98);
  186. SetAPen(Rp,MODBLU+6);
  187. RectFill(Rp,0,98,320,100);
  188. SetAPen(Rp,MODBLU+7);
  189. RectFill(Rp,0,100,320,102);
  190. SetAPen(Rp,MODBLU+8);
  191. RectFill(Rp,0,102,320,104);
  192. SetAPen(Rp,MODBLU+9);
  193. RectFill(Rp,0,104,320,106);
  194. SetAPen(Rp,MODBLU+10);
  195. RectFill(Rp,0,106,320,108);
  196. SetAPen(Rp,MODBLU+11);
  197. RectFill(Rp,0,108,320,110);
  198. SetAPen(Rp,MODBLU+12);
  199. RectFill(Rp,0,110,320,112);
  200. SetAPen(Rp,MODBLU+13);
  201. RectFill(Rp,0,112,320,114);
  202. SetAPen(Rp,MODBLU+12);
  203. RectFill(Rp,0,114,320,116);
  204. SetAPen(Rp,MODBLU+11);
  205. RectFill(Rp,0,116,320,118);
  206. SetAPen(Rp,MODBLU+10);
  207. RectFill(Rp,0,118,320,120);
  208. SetAPen(Rp,MODBLU+9);
  209. RectFill(Rp,0,120,320,122);
  210. SetAPen(Rp,MODBLU+8);
  211. RectFill(Rp,0,122,320,124);
  212. SetAPen(Rp,MODBLU+7);
  213. RectFill(Rp,0,124,320,126);
  214. SetAPen(Rp,MODBLU+6);
  215. RectFill(Rp,0,126,320,128);
  216. SetAPen(Rp,MODBLU+5);
  217. RectFill(Rp,0,128,320,130);
  218. SetAPen(Rp,MODBLU+4);
  219. RectFill(Rp,0,130,320,132);
  220. SetAPen(Rp,MODBLU+3);
  221. RectFill(Rp,0,132,320,134);
  222. SetAPen(Rp,MODBLU+2);
  223. RectFill(Rp,0,134,320,136);
  224.  
  225. SetAPen(Rp,1);
  226. RectFill(0,150,320,152);
  227. SetAPen(Rp,2);
  228. RectFill(0,152,320,154);
  229. SetAPen(Rp,3);
  230. RectFill(0,154,320,156);
  231. SetAPen(Rp,4);
  232. RectFill(0,156,320,158);
  233. SetAPen(Rp,5);
  234. RectFill(0,158,320,160);
  235. SetAPen(Rp,6);
  236. RectFill(0,160,320,162);
  237. SetAPen(Rp,7);
  238. RectFill(0,162,320,164);
  239. SetAPen(Rp,8);
  240. RectFill(Rp,0,164,320,166);
  241. SetAPen(Rp,9);
  242. RectFill(Rp,0,166,320,168);
  243. SetAPen(Rp,10);
  244. RectFill(Rp,0,168,320,170);
  245. SetAPen(Rp,11);
  246. RectFill(Rp,0,170,320,172);
  247. SetAPen(Rp,12);
  248. RectFill(Rp,0,172,320,174);
  249. SetAPen(Rp,13);
  250. RectFill(Rp,0,174,320,176);
  251. SetAPen(Rp,12);
  252. RectFill(Rp,0,176,320,178);
  253. SetAPen(Rp,11);
  254. RectFill(Rp,0,178,320,180);
  255. SetAPen(Rp,10);
  256. RectFill(Rp,0,180,320,182);
  257. SetAPen(Rp,9);
  258. RectFill(Rp,0,182,320,184);
  259. SetAPen(Rp,8);
  260. RectFill(Rp,0,184,320,186);
  261. SetAPen(Rp,7);
  262. RectFill(Rp,0,186,320,188);
  263. SetAPen(Rp,6);
  264. RectFill(Rp,0,188,320,190);
  265. SetAPen(Rp,5);
  266. RectFill(Rp,0,190,320,192);
  267. SetAPen(Rp,4);
  268. RectFill(Rp,0,192,320,194);
  269. SetAPen(Rp,3);
  270. RectFill(Rp,0,194,320,196);
  271. SetAPen(Rp,2);
  272. RectFill(Rp,0,196,320,198);
  273. SetAPen(Rp,1);
  274. RectFill(Rp,0,198,320,199);
  275.  
  276. SetAPen(Rp,BLACK);
  277. RectFill(Rp,0,0,320,29);
  278.  
  279. for (c=0;c<9;c++)
  280. {
  281. SetAPen(Rp,1+c);
  282. Move(Rp,56,77);
  283. Text(Rp,"ELECTRONIC DESIGN PRESENTS",26);
  284. Delay(4);
  285. }
  286.  
  287. for (d=0;d<16;d++)
  288. {
  289. SetSoftStyle(Rp, FSF_ITALIC, 255);
  290. SetAPen(Rp,MODBLU+d);
  291. Move(Rp,116,138);
  292. Text(Rp,"KARATE KING",11);
  293. Delay(4);
  294. }
  295.  
  296.  
  297. SetAPen(Rp,RON);
  298. Move(Rp,320,15);
  299.  
  300. Text(Rp,"This is our fir",15);
  301. Text(Rp,"st Intro writte",15);
  302. Text(Rp,"n in C. We are ",15);
  303. Text(Rp,"a Group of 4. 3",15);
  304. Text(Rp," boys are comin",15);
  305. Text(Rp,"g from Germany ",15);
  306. Text(Rp,"and 1 boy comes",15);
  307. Text(Rp," from Holland. ",15);
  308. Text(Rp," Hello George!!",15);
  309. Text(Rp," What do you th",15);
  310. Text(Rp,"ink about this?",15);
  311. Text(Rp," And here are t",15);
  312. Text(Rp,"he greetings: T",15);
  313. Text(Rp,"om, SCS, Movers",15);
  314. Text(Rp,", The New Age, ",15);
  315. Text(Rp,"E.C.A, S.S.I an",15);
  316. Text(Rp,"d The Star Fron",15);
  317. Text(Rp,"tiers.         ",15);
  318. Text(Rp,"PRESS SPACE ...",15);
  319. Text(Rp,".......        ",15);
  320. Text(Rp,"               ",15);
  321. Text(Rp,"               ",15);
  322.  
  323. Scroll (1,0);
  324. }
  325.  
  326. Scroll (x,y)
  327. int x,y;
  328. {
  329. int line;
  330. int f,g,h,i;
  331. for (line = 0; line < 3840; line++)
  332. {
  333. while(message=GetMsg(Wdw->UserPort))
  334. class=message->Class;
  335. if(class==VANILLAKEY) goto ScrollReady;
  336. ScrollLayer (0, Wdw->WLayer, x,y);
  337. WaitTOF();
  338. }
  339. ScrollReady:
  340. CloseWindow(Wdw);
  341. CloseScreen(CustScr);
  342. CloseLibrary(GfxBase);
  343. CloseLibrary(LayersBase);
  344. Exit (TRUE);
  345. }
  346.  
  347.